#ifndef __SNATC_H__
#define __SNATC_H__

#include <rtthread.h>

#define CHAT_READ_BUF_MAX 256
#define MODEM_CHAT_RESP_MAX 6
#define CHAT_DATA_FMT           "<tx: %s, want: %s, retries: %u, timeout: %u>"
#define CHAT_DATA_STR(data)     (data)->transmit, (data)->expect, (data)->retries, (data)->timeout

struct atc_set_data {
    const char* transmit;
    const char* expect;      // use CHAT_RESP_xxx
    rt_uint8_t retries;
    rt_uint8_t timeout;     // second
    rt_uint8_t cr;
};


struct atc_set_ops
{
	void (*flush_rx)(rt_device_t dev);
	rt_size_t (*read)(rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size, int timeout);
	rt_size_t (*write)(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size, int timeout);
};


// void atc_flush_rx(rt_device_t serial);
rt_err_t atc_set(struct atc_set_ops *atc_pos, rt_device_t dev, const struct atc_set_data *data, rt_size_t len);
#endif
